<!-- This comment will put IE 6, 7 and 8 in quirks mode -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Voodoo Shader Framework: Texture Formats and Depth Buffers</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javaScript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<!-- Generated by Doxygen 1.6.3 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Search');
--></script>
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li class="current"><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <img id="MSearchSelect" src="search/search.png"
             onmouseover="return searchBox.OnSearchSelectShow()"
             onmouseout="return searchBox.OnSearchSelectHide()"
             alt=""/>
        <input type="text" id="MSearchField" value="Search" accesskey="S"
             onfocus="searchBox.OnSearchFieldFocus(true)" 
             onblur="searchBox.OnSearchFieldFocus(false)" 
             onkeyup="searchBox.OnSearchFieldChange(event)"/>
        <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
        </div>
      </li>
    </ul>
  </div>
</div>
<div class="contents">


<h1><a class="anchor" id="TextureFormat">Texture Formats and Depth Buffers </a></h1><h2><a class="anchor" id="Texture">
Formats</a></h2>
<div> For most of these formats, DirectX and OpenGL equivalents are indicated below, along with a notation indicating if the texture may be used as a render-target or copied to and from.</div><div> <table class="doxtable">
<tr>
<th>Voodoo Format </th><th>DirectX Format </th><th>OpenGL Format </th><th>RT/Copy  </th></tr>
<tr>
<td>Unknown </td><td>D3DFMT_UNKNOWN </td><td>(unknown) </td><td>No  </td></tr>
<tr>
<td>RGB5 </td><td>D3DFMT_X1R5G5B5 </td><td>GL_RGB5 </td><td>Yes  </td></tr>
<tr>
<td>RGB5A1 </td><td>D3DFMT_A1R5G5B5 </td><td>GL_RGB5_A1 </td><td>Yes  </td></tr>
<tr>
<td>RGB8 </td><td>D3DFMT_X8R8G8B8 </td><td>GL_RGB8 </td><td>Yes  </td></tr>
<tr>
<td>RGB8A1 </td><td>D3DFMT_A8R8G8B8 </td><td>GL_RGB8_A1 </td><td>Yes  </td></tr>
<tr>
<td>RGB10A2 </td><td>D3DFMT_A2R10G10B10 </td><td>GL_RGB10_A2 </td><td>Yes  </td></tr>
<tr>
<td>RGBA16F<sup>1</sup></td><td>D3DFMT_A16B16G16R16F</td><td>GL_RGBA16F</td><td>N/Y  </td></tr>
<tr>
<td>RGBA32F<sup>1</sup></td><td>D3DFMT_A32B32G32R32F</td><td>GL_RGBA32F</td><td>N/Y  </td></tr>
<tr>
<td>D16F </td><td>D3DFMT_A2R10G10B10 </td><td>GL_DEPTH_COMPONENT16</td><td>N/Y-ish </td></tr>
<tr>
<td>D32F </td><td>D3DFMT_A32B32G32R32F</td><td>GL_DEPTH_COMPONENT32</td><td>N/Y-ish </td></tr>
</table>
<p><em>Note <sup>1</sup>:</em> Floating-point texture formats (RGBA16F and RGBA32F) may not be supported on all hardware. </div><h2><a class="anchor" id="Depth">
Buffers</a></h2>
<div> DirectX 9 applies some stupid restrictions to depth textures. Adapters targetting this API should work around these in some way and provide the Core with a valid texture containing the depth data. Due to the restrictions, the recommended format for this texture is R32F (D3DFMT_R32F). </div> <div> This can be complicated and is always a pain to do, so it may be beneficial to use the prebuilt solution in the generic Voodoo DirectX 9 adapter. This solution has been set up to use a D24S8 stencil buffer on the underlying hardware, while abstracting it to a R32F texture for shader access. This solution has been derived from work done in the Morrowind Graphics Extender project, and would probably not exist without the efforts of phal and a few others from the Bethesda Softworks forum (give them a hand for making this easy for the rest of us). </div> </div>
<!--- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&nbsp;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&nbsp;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&nbsp;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&nbsp;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&nbsp;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&nbsp;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&nbsp;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&nbsp;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&nbsp;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&nbsp;</span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&nbsp;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<hr class="footer"/><address style="text-align: right;"><small>Generated on Thu Oct 14 21:44:39 2010 for Voodoo Shader Framework by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>
